<!doctype html>
<!--
 * Copyright 2017 The Chromium Authors. All rights reserved.  Use of this
 * source code is governed by a BSD-style license that can be found in the
 * LICENSE file.
-->
<html>
<header>
	<style>
	#editbox {
		position: fixed;
		width: 200px;
		height: 100px;
	}
	</style>
</header>
<body>
  <input id="editbox"/>
  <script>
  var parentWindow = null;
  var input = null;

  window.addEventListener('load', function() {
    input = document.getElementById('editbox');
    input.addEventListener('focus', function() {      
      input.value = 'A B X D';
      parentWindow.postMessage({type: 'focus'}, '*');
    });
  });

  window.addEventListener('message', function(e) {
    parentWindow = e.source;
    parentWindow.postMessage({type: 'init'}, '*');		
  });

  window.addEventListener('input', function(e) {
   parentWindow.postMessage({
     type: 'input',
     value: input.innerText}, '*');
 });
  
  </script>
</body>
</html>